<?php
include ("../../PCO.php");
?>
<html>
	<head>
		<script src="<?=URL_JS?>jquery.js"></script>
		<link rel="stylesheet" href="<?=URL_CSS?>themisstyle2.css"> 
		<SCRIPT LANGUAGE="JavaScript">
			$(document).ready(function(){
				/////////////////////////////////////////////////////////////////////////////		 
				// Pour faire du ajax cross-domain (utile en IE pas pour firefox)
				jQuery.support.cors = true;
				/////////////////////////////////////////////////////////////////////////////
				var dataString = '';
				$.ajax	({
					type: "POST",
					url: "./vues_client/Liste_clients.php",
					data: dataString,
					cache: false,
					success: function(html){
						$("#container").html(html);
					},
					// code to run if the request fails
					// the raw request and status codes are
					// passed to the function
					error: function(xhr, status, errorThrown) {
							alert('Liste_clients.php' + ' : error ajax - contactez DESI : status '+ status + ' && ' + errorThrown);
					}
				});
			});
			
			var page=1;	
			function recherche()
			 {  
				var dataString = 'cli='+document.getElementById('cli').value+'&page='+page;
				$.ajax	({
					type: "POST",
					url: "./vues_client/Liste_clients.php",
					data: dataString,
					cache: false,
					success: function(html){
						$("#container").html(html);
					},
					error: function(xhr, status, errorThrown) {
							alert('Liste_clients.php' + ' : error ajax - contactez DESI : status '+ status + ' && ' + errorThrown);
					}
				});
			 }
		    
		</SCRIPT>
	</head>
	<body >
		<br/>
		<form method='get' action='./index_client.php'>
			Client: <input type="text" name="numCli" id="numCli" size="7"/>
			<input type="submit" name="s" id="s" value="visualiser" onClick="if(document.getElementById('numCli').value=='') return false;"/>
		</form>
		<br/><br/></br>
	    <h3><span>Rechercher un client</span></h3>
		<br/>
	    <input type="text" id="cli">&nbsp;<input type="button" value="rechercher" onClick="recherche()">
		<input type="button" value="  <  " onClick="page=Math.max(1,page-1);recherche()">&nbsp;&nbsp;<input type="button" value="  >  " onClick="page=page+1;recherche()">
		<div id="container">
		</div>
	</body>
</html>
